DarkRP
A library of DarkRP compatibility functions.
Functions
playerMeta:addMoney(amount)
Adds money to Adds money to the player's character. This function uses Lilia methods to add the specified amount of money to the player. It handles wallet limits and spawns excess money as an item in the world if necessary.
Parameters
-
amount
Integer
The amount of money to add.
Example Usage
player:addMoney(1000)
playerMeta:canAfford(amount)
Checks if the player's character can afford a specified amount of money. This function uses Lilia methods to determine if the player can afford the specified amount. It is designed to be compatible with the DarkRP canAfford method.
Parameters
-
amount
Integer
The amount of money to check.
Returns
-
Boolean
Whether the player's character can afford the specified amount of money.
Example Usage
if player:canAfford(500) then
print("Player can afford the item.")
else
print("Player cannot afford the item.")
end
playerMeta:getDarkRPVar(var)
Retrieves the player's DarkRP money. This is used as compatibility for DarkRP Vars.
Parameters
-
var
String
The DarkRP variable to fetch (only "money" is allowed).
Returns
-
Integer or nil
The player's money if the variable is valid, or nil if not.
Example Usage
local money = player:getDarkRPVar("money")
if money then
print("Player Money:", money)
end
playerMeta:getMoney()
Retrieves the amount of money owned by the player's character.
Returns
-
Integer
The amount of money owned by the player's character.
Example Usage
local money = player:getMoney()
print("Player Money:", money)
playerMeta:takeMoney(amount)
Takes money from the player's character.
Parameters
-
amount
Integer
The amount of money to take.
Example Usage
player:takeMoney(200)